package org.csmzxy.class2333;

//动物类
class Animal{
    public void speak(){
        System.out.println("动物发出的吼叫");
    }
}
//狗类
class Dog extends Animal{
    @Override
    public void speak(){
        System.out.println("狗发出汪汪的叫声");
    }
}
//猫类
class Cat extends Animal{
    @Override
    public void speak(){
        System.out.println("猫发出喵喵的叫声");
    }
}
public class Example02 {
    public static void main(String[] args){
        Animal animal = new Animal();
        animal.speak();

        Dog dog = new Dog();
        dog.speak();

        Cat cat = new Cat();
        cat.speak();
    }
}
